﻿<%@ Page Title="" Language="C#" MasterPageFile="~/ModulesPage.Master" AutoEventWireup="true" CodeBehind="DutiesManagement.aspx.cs" Inherits="SwenAssignment3.HousekeepingManagementModule.DutiesManagement" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="125px" AutoGenerateRows="False" CellPadding="4" DataKeyNames="DutiesID" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None">
                <AlternatingRowStyle BackColor="White" />
                <CommandRowStyle BackColor="#FFFFC0" Font-Bold="True" />
                <FieldHeaderStyle BackColor="#FFFF99" Font-Bold="True" />
                <Fields>
                    <asp:BoundField DataField="DutiesID" HeaderText="DutiesID" ReadOnly="True" SortExpression="DutiesID" />
                    <asp:BoundField DataField="DutyName" HeaderText="DutyName" SortExpression="DutyName" />
                    <asp:BoundField DataField="StartPeriod" HeaderText="StartPeriod" SortExpression="StartPeriod" />
                    <asp:BoundField DataField="EndPeriod" HeaderText="EndPeriod" SortExpression="EndPeriod" />
                    <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
                    <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowInsertButton="True" />
                </Fields>
                <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
                <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
            </asp:DetailsView>
            <br />
            <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="DutiesID" DataSourceID="SqlDataSource1">
                <Columns>
                    <asp:CommandField ShowSelectButton="True" />
                    <asp:BoundField DataField="DutiesID" HeaderText="DutiesID" ReadOnly="True" SortExpression="DutiesID" />
                    <asp:BoundField DataField="DutyName" HeaderText="DutyName" SortExpression="DutyName" />
                    <asp:BoundField DataField="StartPeriod" HeaderText="StartPeriod" SortExpression="StartPeriod" />
                    <asp:BoundField DataField="EndPeriod" HeaderText="EndPeriod" SortExpression="EndPeriod" />
                    <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
                </Columns>
            </asp:GridView>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Data Source=USER-MSI\MSSQLSERVER2012;Initial Catalog=DRHotelDB;User ID=sa;Password=imsa" DeleteCommand="DELETE FROM [Duties] WHERE [DutiesID] = @DutiesID" InsertCommand="INSERT INTO [Duties] ([DutiesID], [DutyName], [StartPeriod], [EndPeriod], [Description]) VALUES (@DutiesID, @DutyName, @StartPeriod, @EndPeriod, @Description)" ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM [Duties]" UpdateCommand="UPDATE [Duties] SET [DutyName] = @DutyName, [StartPeriod] = @StartPeriod, [EndPeriod] = @EndPeriod, [Description] = @Description WHERE [DutiesID] = @DutiesID">
                <DeleteParameters>
                    <asp:Parameter Name="DutiesID" Type="String" />
                </DeleteParameters>
                <InsertParameters>
                    <asp:Parameter Name="DutiesID" Type="String" />
                    <asp:Parameter Name="DutyName" Type="String" />
                    <asp:Parameter DbType="Date" Name="StartPeriod" />
                    <asp:Parameter DbType="Date" Name="EndPeriod" />
                    <asp:Parameter Name="Description" Type="String" />
                </InsertParameters>
                <UpdateParameters>
                    <asp:Parameter Name="DutyName" Type="String" />
                    <asp:Parameter DbType="Date" Name="StartPeriod" />
                    <asp:Parameter DbType="Date" Name="EndPeriod" />
                    <asp:Parameter Name="Description" Type="String" />
                    <asp:Parameter Name="DutiesID" Type="String" />
                </UpdateParameters>
            </asp:SqlDataSource>
            <br />
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
